home *** CD-ROM | disk | FTP | other *** search
/ PCGUIA 2010 Software/Programs / PCGuia_programas.iso / Software / Internet / FeedDemon / FeedDemonInstall.exe / {app} / Data / FeedReport.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2009-09-15  |  9.7 KB  |  278 lines

  1. <?xml version="1.0"?>
  2.  
  3. <xsl:stylesheet version="1.0"
  4.     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  5.     xmlns:fd="http://www.bradsoft.com/feeddemon/xmlns/1.0/">
  6.  
  7. <xsl:output method="html"
  8.     doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
  9.     doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
  10.  
  11. <!-- report type:
  12.       0 = frptDinosaurs
  13.       1 = frptHttpErrors
  14.       2 = frptFeedAttention 
  15. -->
  16. <xsl:variable name="rpt-type" select="opml/@reportType"/>
  17.  
  18. <xsl:variable name="group-by-folder" select="$FEED-RPT-GROUPBY-FOLDER$"/>
  19.  
  20. <!-- used when grouping by folder -->
  21. <xsl:key name="key-group" match="opml/body/outline" use="@folderName" />
  22.  
  23. <!-- each report has a different number of columns -->
  24. <xsl:variable name="num-cols">
  25.     <xsl:choose>
  26.         <xsl:when test="$rpt-type=0">4</xsl:when>
  27.         <xsl:when test="$rpt-type=1">5</xsl:when>
  28.         <xsl:when test="$rpt-type=2">5</xsl:when>
  29.     </xsl:choose>
  30. </xsl:variable>
  31.  
  32. <xsl:template match="opml">
  33. <html>
  34. <head>
  35.     <title><xsl:value-of select="head/title"/></title>
  36.     $INCLUDE(metatrans.inc)$
  37.     <style type="text/css">
  38.         $INCLUDE(surfer.css)$
  39.         table {
  40.             border: 1px solid $COLOR-GROUP-HEADER-BORDER$;
  41.             table-layout: fixed; /* http://msdn2.microsoft.com/en-us/library/ms533020.aspx#Use_Fixed-Size_Tables */
  42.         }
  43.         th {
  44.             font-weight: normal;
  45.             font-size: small;
  46.             background-color: $COLOR-GROUP-HEADER$;
  47.             padding-top: 0;
  48.             padding-bottom: 0;
  49.         }
  50.         th, td { border-bottom: 1px solid $COLOR-GROUP-HEADER-BORDER$;    }
  51.     
  52.         .col-counter { width: 28px; text-align: right;}
  53.         .col-feedtitle { width: 60%; text-align: left; }
  54.         .col-lastpostdate { text-align: center; }
  55.         .col-icon { text-align: left; width: 32px; }
  56.         
  57.         .groupheader {
  58.             text-align: left;
  59.             background-color: $COLOR-PAGEHEAD1$;
  60.             color: $COLOR-PAGEHEAD-FONT$;
  61.         }
  62.         tr.odd {    background-color: $COLOR-SIDEBAR$;}
  63.         span.feed-title { margin-right: 6px; }
  64.         div.none { margin: 24px;  }
  65.  
  66.         /* for dinosaur report dropdown */
  67.         a.spin { 
  68.             text-decoration: underline;
  69.         }
  70.         a.spin:hover {
  71.             color : $COLOR-PAGEHEAD2$ !important;
  72.       }
  73.  
  74.         img.indicator {            
  75.             height:14px;
  76.             border:1px solid $COLOR-GROUP-HEADER-BORDER$; 
  77.             filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=2,OffY=2,Color=$COLOR-GROUP-HEADER$);
  78.         }
  79.         
  80.         div#page-actions {
  81.             float: right;
  82.             margin-right: 24px;
  83.             vertical-align: middle;
  84.             font-size: smaller;
  85.         }
  86.         /* extra top/bottom padding to enlarge clickable space */
  87.         div#page-actions img { margin: 0; padding: 4px 0;}
  88.     </style>
  89. </head>
  90. <body>
  91.     <div id="pagehead">
  92.         <div id="newspapertitle">
  93.             <div id="page-actions">
  94.                 <!-- show "Export" link for attention report -->
  95.                 <xsl:if test="$rpt-type=2">
  96.                     <a href="fdaction:?action=exporttopfeeds">$LANG_CONST(S_Export)$...</a>
  97.                 </xsl:if>
  98.             </div>
  99.             <!-- report image -->
  100.             <xsl:choose>
  101.                 <xsl:when test="$rpt-type=0"><img src="$IMAGEDIR$dinosaur-lg.png" align="absmiddle" /></xsl:when>
  102.                 <xsl:when test="$rpt-type=1"><img src="$IMAGEDIR$httperror-lg.png" align="absmiddle" /></xsl:when>
  103.                 <xsl:when test="$rpt-type=2"><img src="$IMAGEDIR$attention-lg.png" align="absmiddle" /></xsl:when>
  104.             </xsl:choose>
  105.             <!-- report title -->
  106.             <xsl:value-of select="head/pageTitle" disable-output-escaping="yes"/>
  107.         </div>
  108.     </div>
  109.  
  110.     <div id="container">
  111.         <xsl:choose>
  112.             <xsl:when test="count(body/outline)=0">
  113.                 <div class="none">$LANG_CONST(S_None)$</div>
  114.             </xsl:when>
  115.             <xsl:otherwise>
  116.                 <table cellspacing="0" cellpadding="5" align="center">
  117.                 <tr>
  118.                     <th class="col-counter feedreport"> <!-- number column --></th>
  119.                     <th class="col-feedtitle feedreport">$LANG_CONST(S_NewsLblFeedTitle)$</th>
  120.                     <th class="col-lastpostdate feedreport">$LANG_CONST(S_StatLastPostDate)$</th>
  121.                     <!-- show HTTP status for error report -->
  122.                     <xsl:if test="$rpt-type=1">
  123.                         <th align="center" class="feedreport">$LANG_CONST(S_StatLastHttpStatus)$</th>
  124.                     </xsl:if>
  125.                     <!-- show attention rank for attention report -->
  126.                     <xsl:if test="$rpt-type=2">
  127.                         <th align="right" class="feedreport">$LANG_CONST(S_StatAttention)$</th>
  128.                     </xsl:if>
  129.                     <!-- icon column -->
  130.                     <th class="col-icon feedreport">                    
  131.                         <xsl:choose>
  132.                             <xsl:when test="$rpt-type=2">
  133.                                 <a class="icon" style="margin-left: 12px" href="fdaction:?action=resetattentionall" title="$LANG_CONST(S_NewsResetAttentionAll)$">
  134.                                     <img class="icon" src="$IMAGEDIR$resetattn.gif" align="absmiddle" />                                    
  135.                                 </a>
  136.                             </xsl:when>
  137.                             <xsl:otherwise> </xsl:otherwise>
  138.                         </xsl:choose>                            
  139.                     </th>
  140.                 </tr>
  141.                 <xsl:choose>
  142.                     <xsl:when test="$group-by-folder=1">
  143.                         <!-- group header for this folder -->
  144.                         <xsl:for-each select="body/outline[count(. | key('key-group', @folderName)[1]) = 1]">
  145.                             <xsl:sort select="@folderName"/>
  146.                             <xsl:variable name="groupid" select="@folderName"/>
  147.                             <xsl:call-template name="groupheader">
  148.                                 <xsl:with-param name="group-id" select="$groupid"/>
  149.                                 <xsl:with-param name="group-caption" select="@folderName"/>
  150.                             </xsl:call-template>
  151.                             <!-- output each feed in this folder - note that feeds are output in the order they appear in the OPML, since FeedDemon takes care of pre-sorting them -->
  152.                             <xsl:for-each select="key('key-group', @folderName)">
  153.                                 <xsl:call-template name="outline">
  154.                                     <xsl:with-param name="row-num" select="position()"/>
  155.                                 </xsl:call-template>
  156.                             </xsl:for-each>
  157.                         </xsl:for-each>
  158.                     </xsl:when>
  159.                     <!-- no grouping -->
  160.                     <xsl:otherwise>
  161.                         <xsl:for-each select="body/outline">
  162.                             <xsl:call-template name="outline">
  163.                                 <xsl:with-param name="row-num" select="position()"/>
  164.                             </xsl:call-template>                        
  165.                         </xsl:for-each>
  166.                     </xsl:otherwise>
  167.                 </xsl:choose>
  168.             </table>
  169.         </xsl:otherwise>
  170.     </xsl:choose>
  171.     </div>
  172.     <br />
  173. </body>
  174. </html>
  175. </xsl:template>
  176.  
  177. <!-- feed template -->
  178. <xsl:template name="outline">
  179.     <xsl:param name="row-num"/>
  180.     <xsl:variable name="feedId" select="@feedId"/>
  181.     <xsl:variable name="tr-class">
  182.         <xsl:choose>
  183.             <xsl:when test="$row-num mod 2 = 1">odd</xsl:when>
  184.             <xsl:otherwise>even</xsl:otherwise>
  185.         </xsl:choose>
  186.     </xsl:variable>
  187.     <xsl:variable name="feed-class">
  188.         <xsl:choose>
  189.             <xsl:when test="@numFlagged>0">flagged</xsl:when>
  190.             <xsl:otherwise>normal</xsl:otherwise>
  191.         </xsl:choose>
  192.     </xsl:variable>                        
  193.  
  194.     <xsl:variable name="show-favicons" select="$SHOW-FAVICONS$"/>
  195.     
  196.     <tr class="{$tr-class}">
  197.         <td class="col-counter">
  198.             <xsl:value-of select="$row-num"/>.
  199.         </td>
  200.         <!-- feed title and icons -->
  201.         <td class="col-feedtitle">
  202.             <!-- feed favicon -->
  203.             <xsl:if test="$show-favicons=1">$FAVICON(<xsl:value-of select="$feedId"/>)$</xsl:if>
  204.             <a class="{$feed-class}" href="fdaction:?action=gotofeed&feedid={$feedId}" title="$LANG_CONST(S_NewsHintGotoFeed)$">
  205.                 <span class="feed-title"><xsl:value-of select="@title" disable-output-escaping="yes"/></span>
  206.             </a>
  207.             <!-- open feed home page in new tab -->
  208.             <a class="icon" href="{@htmlUrl}" target="_blank" title="$LANG_CONST(S_NewsHintOpenInNewTab)$">
  209.                 <img class="icon" src="$IMAGEDIR$linknew.gif" align="absmiddle" />
  210.             </a>
  211.             <!-- feed menu -->
  212.             <a class="icon" href="fdaction:?action=showfeedmenu&feedid={$feedId}" title="$LANG_CONST(S_NewsHintFeedOptions)$">
  213.                 <img class="icon" src="$IMAGEDIR$arrow-dropdown.gif" align="absmiddle" />
  214.             </a>
  215.         </td>
  216.         <!-- last post date -->
  217.         <td class="col-lastpostdate">
  218.             <xsl:choose>
  219.                 <xsl:when test="@lastPostDateDisplay">
  220.                     <xsl:value-of select="@lastPostDateDisplay"/>
  221.                 </xsl:when>
  222.                 <xsl:otherwise>?</xsl:otherwise>
  223.             </xsl:choose>
  224.         </td>
  225.         <!-- http status -->
  226.         <xsl:if test="$rpt-type=1">
  227.             <td align="center">
  228.                 <xsl:choose>
  229.                     <xsl:when test="@httpLastStatusCode">
  230.                         <a style="cursor:help" title="{@httpErrorText}"><xsl:value-of select="@httpLastStatusCode"/></a>
  231.                     </xsl:when>
  232.                     <xsl:otherwise>?</xsl:otherwise>
  233.                 </xsl:choose>
  234.             </td>
  235.         </xsl:if>
  236.         <!-- feed attention -->
  237.         <xsl:if test="$rpt-type=2">
  238.             <xsl:variable name="attn-percent">
  239.                 <xsl:choose>
  240.                     <xsl:when test="@attentionPercent>98">98</xsl:when>
  241.                     <xsl:when test="@attentionPercent=0">0</xsl:when>
  242.                     <xsl:when test="@attentionPercent<1">1</xsl:when>
  243.                     <xsl:otherwise><xsl:value-of select="@attentionPercent"/></xsl:otherwise>
  244.                 </xsl:choose>
  245.             </xsl:variable>
  246.             <td align="right">
  247.                 <img class="indicator" style="width:{$attn-percent}%;" src="$IMAGEDIR$progress-green.gif" alt="$LANG_CONST(S_StatAttention)$={@attentionRank}" />
  248.             </td>
  249.         </xsl:if>
  250.         <!-- icon column -->    
  251.         <td class="col-icon">
  252.             <xsl:if test="$rpt-type=2">
  253.                 <!-- reset attention -->                                
  254.                 <a class="icon" style="margin-left: 12px" href="fdaction:?action=resetattention&feedid={$feedId}" title="$LANG_CONST(S_NewsResetAttention)$">
  255.                     <img class="icon" src="$IMAGEDIR$resetattn.gif" align="absmiddle" />                                    
  256.                 </a>
  257.             </xsl:if>                            
  258.             <xsl:if test="$rpt-type=0 or $rpt-type=1">
  259.                 <!-- unsubcribe -->
  260.                 <a class="icon" href="fdaction:?action=unsubscribe&feedid={$feedId}" title="$LANG_CONST(S_NewsHintUnsubscribe)$">
  261.                     <img class="icon" src="$IMAGEDIR$unsubscribe.png" align="absmiddle" />
  262.                 </a>
  263.             </xsl:if>
  264.         </td>
  265.     </tr>
  266. </xsl:template>
  267.  
  268. <!-- group header template -->
  269. <xsl:template name="groupheader">
  270.     <xsl:param name="group-id"/>
  271.     <tr>
  272.         <th colspan="{$num-cols}" class="groupheader" id="{$group-id}_header">
  273.             <img src="$IMAGEDIR$folder.gif" align="absmiddle" style="margin-right:6px;" /><xsl:value-of select="$group-id" disable-output-escaping="yes"/>
  274.         </th>
  275.     </tr>
  276. </xsl:template>
  277.  
  278. </xsl:stylesheet>